home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO4.DMS / in.adf / Tutorials / Menus / Menus_7.AMOS / Menus_7.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-28  |  4.3 KB  |  153 lines

  1. '*************************** 
  2. '*    AMOS Professional    * 
  3. '*                         * 
  4. '*         MENUS 7         * 
  5. '*                         *                 ANIMATED MENUS
  6. '* (c) Europress Software  *                 MENU FUNCTIONS
  7. '*                         *                       AND 
  8. '*     Ronnie Simpson      *                  MOVING MENUS 
  9. '*************************** 
  10. '
  11. '------------------------------------------- 
  12. 'Menu Called 
  13. '------------------------------------------- 
  14. 'automatic redrawing of a selected menu
  15. '
  16. 'The Menu Called instruction is used in conjunction with a menu procedure
  17. 'allowing animated items.  
  18. 'The menu will automatically be redrawn 50 times a second whenever it is 
  19. 'displayed on the screen whilst the Menu Called is active. 
  20. 'The procedures called must be kept fairly short so as not to destroy the
  21. 'effect and bobs may tend to flicker as the menu cannot be double buffered.  
  22. 'A typical set up might look something like this:- 
  23. '
  24. '           Menu$(1,1)="(REserve 4:Proc TEST)" 
  25. '           Menu Called(1,1) 
  26. '             :        :   
  27. '
  28. '           Procedure TEST 
  29. '             :        : 
  30. '           End Proc 
  31. '
  32. '------------------------------------------- 
  33. 'Menu Once 
  34. '------------------------------------------- 
  35. 'turn off automatic redrawing
  36. '
  37. 'Menu Once switches off the automatic redrawing produced by the Menu Called
  38. 'command and returns the system to normal. 
  39. '
  40. 'eg.         Menu Once 
  41. '
  42. '------------------------------------------- 
  43. 'X Menu
  44. '------------------------------------------- 
  45. 'return an x coordinate from a menu item 
  46. '
  47. 'The value returned by the X Menu function is not a normal screen
  48. 'coordinate but the X value relative to the start position of the
  49. 'menu item selected. 
  50. '
  51. 'eg.             X=X Menu(2,1) 
  52. '------------------------------------------- 
  53. 'Y Menu
  54. '------------------------------------------- 
  55. 'return a Y coordinate from a menu item  
  56. '
  57. 'Same as the above X Menu function only the Y coordinate is returned.
  58. '
  59. '------------------------------------------- 
  60. 'Menu Base 
  61. '------------------------------------------- 
  62. 'move the menu display starting point
  63. '
  64. 'eg.       Menu Base 100,50
  65. '
  66. 'the above example would cause the menu to be displayed starting at the  
  67. 'screen coordinates given in the parameters, all other menu items would
  68. 'now be displayed relative to this point.
  69. '
  70. '------------------------------------------- 
  71. 'Set Menu
  72. '------------------------------------------- 
  73. 'move a menu item
  74. '
  75. 'Set Menu sets the coordinates of the top left corner of a menu item, these
  76. 'coordinates are measured relative to the previous level settings. 
  77. 'All subsequent levels will also be moved by this instruction. 
  78. 'Values can also be negative allowing menu items to appear above the menu
  79. 'bar (or in any position for that matter).   
  80. '
  81. 'eg.          Set Menu(2,1) To 40,-50
  82. '
  83. '------------------------------------------- 
  84. 'WORKING EXAMPLES
  85. '------------------------------------------- 
  86. Global C,N
  87. Rem *** tidy up the screen 
  88. '
  89. Screen Open 0,640,200,16,Hires
  90. Palette $0,$F00,$F0,$F,$FF0,$F0F,$FF,$F70,$7F,$70F,$F07,$333,$666,$999,$CCC,$FFF
  91. Flash Off : Curs Off : Cls 0 : Pen 0 : Paper 8
  92. '
  93. Rem *** set the menu titles
  94. '
  95. Menu Static 1
  96. Menu$(1)="       TITLE 1                 ","(SS4)      TITLE 1 (ss0)"
  97. Menu$(2)="TITLE 2                 ","(ss4)TITLE 2 (ss0)"
  98. Menu$(3)="TITLE 3 ","(SS4)TITLE 3 (ss0)"
  99. '
  100. Rem *** set menu options 
  101. '
  102. Menu$(1,1)="(PRoc TEST)"
  103. Menu$(1,2)="    NEAT EH!    ","(in1,4)(SS4)      WOW!     (ss0)"
  104. '
  105. Paper 5
  106. Menu$(2,1)="                 "
  107. Menu$(2,2)="  USE SET MENU   "
  108. Menu$(2,3)="  INSTRUCTION    "
  109. Menu$(2,4)=" TO RE-POSITION  "
  110. Menu$(2,5)="    OPTIONS.     "
  111. Menu$(2,6)=" ^^^^^^^^^^^^^^^ "
  112. '
  113. Paper 4
  114. Menu$(3,1)="  QUIT  "
  115. '
  116. Menu Base 40,80
  117. '
  118. Rem *** position menu options
  119. Set Menu(1,1) To 10,14
  120. Set Menu(1,2) To 0,68
  121. Set Menu(2,1) To -32,-56
  122. Set Menu(3,1) To 0,34
  123. '
  124. Rem *** activate menu
  125. Menu On 
  126. '
  127. Rem *** start auto updating
  128. Menu Called(1,1)
  129. '
  130. Rem *** start a loop and check for quit
  131. '
  132. Paper 0 : Pen 2
  133. Locate 0,24 : Centre "HOLD RIGHT MOUSE KEY TO SEE MENU"
  134. Do 
  135.    If Choice(1)=3
  136.       If Choice(2)=1
  137.          Edit 
  138.       End If 
  139.    End If 
  140. Loop 
  141. '
  142. Procedure TEST
  143.    Ink C
  144.    Draw 52+N*2,94 To 178-N*2,158
  145.    Draw 178,94+N To 52,158-N
  146.    Ink 0 : Circle 115,126,N/2+1
  147.    Add N,1,0 To 63
  148.    If N=1
  149.       Add C,1,1 To 7
  150.    End If 
  151.    Dreg(0)=130
  152.    Dreg(1)=65
  153. End Proc